package com.goldmantis.alitrip.controller.system;

import com.goldmantis.alitrip.common.ReturnMessage;
import com.goldmantis.alitrip.pojo.SysLog;
import com.goldmantis.alitrip.pojo.SysRole;
import com.goldmantis.alitrip.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(description = "日志查询")
@RequestMapping("sys/log")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    @GetMapping()
    @ApiOperation(value = "日志列表", httpMethod = "GET")
    public ResponseEntity<ReturnMessage> list(
            @ApiParam("查询对象") SysLog sysLog,
            @ApiParam("当前页") @RequestParam(defaultValue = "1") Integer offset,
            @ApiParam("每页显示数量") @RequestParam Integer limit) {
        return ResponseEntity.ok(ReturnMessage.success(sysLogService.pageList(sysLog, offset, limit)));
    }

}
